package com.smartleanx.module.hrm.controller.admin.esign.archiving;


import com.smartleanx.framework.common.pojo.CommonResult;
import com.smartleanx.module.hrm.controller.admin.esign.archiving.param.HrmEContractArchivingParam;
import com.smartleanx.module.hrm.service.esign.eums.FolderTypeEnum;
import com.smartleanx.module.hrm.service.esign.service.HrmEContractArchivingService;
import com.smartleanx.module.hrm.service.esign.temp.ESignDocTempService;
import com.smartleanx.module.hrm.service.esign.temp.po.HrmEFolder;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name =  "归档")
@RestController
@RequestMapping("/hrm/esign/archiving")
public class ESignArchivingController {

    @Autowired
    private HrmEContractArchivingService hrmEContractArchivingService;

    @Autowired
    private ESignDocTempService eSignDocTempService;

    @Operation(summary = "添加归档分组")
    @PostMapping("/saveFolder")
    public CommonResult saveFolder(@RequestBody HrmEFolder param) {
        param.setFolderType(FolderTypeEnum.ARCHIVING.getCode());
        param.setDataStatus(1);
        return CommonResult.success(eSignDocTempService.saveFolder(param)).setCode(200);
    }

    @Operation(summary = "修改分组")
    @PostMapping("/updateFolder")
    public CommonResult updateFolder(@RequestBody HrmEFolder param) {
        return CommonResult.success(eSignDocTempService.updateFolder(param)).setCode(200);
    }

    @Operation(summary = "删除分组")
    @PostMapping("/removeFolder")
    public CommonResult removeFolder(@RequestBody HrmEFolder param) {
        return CommonResult.success(eSignDocTempService.removeFolder(param)).setCode(200);
    }

    @Operation(summary = "获取分组信息")
    @GetMapping("/getFolderDetail")
    public CommonResult getFolderDetail(Long id) {
        return CommonResult.success(eSignDocTempService.getFolderDetail(id)).setCode(200);
    }

    @Operation(summary = "查询分组")
    @GetMapping("/getFolderResult")
    public CommonResult getFolderResult() {
        return CommonResult.success(eSignDocTempService.getFolderResult(FolderTypeEnum.ARCHIVING.getCode())).setCode(200);
    }

    @Operation(summary = "查询父级列表")
    @GetMapping("/getParentFolderResult")
    public CommonResult getParentFolderResult() {
        return CommonResult.success(eSignDocTempService.getParentFolderResult(FolderTypeEnum.ARCHIVING.getCode())).setCode(200);
    }


    @Operation(summary = "查询归档列表")
    @GetMapping("/getArchivingPage")
    public CommonResult getArchivingPage(HrmEContractArchivingParam param) {
        return CommonResult.success(hrmEContractArchivingService.getArchivingPage(param)).setCode(200);
    }





}
